# -*- coding:utf8 -*-
__author__ = 'nickleo'


class shape_group(object):
    def __init__(self, _shape_group_name, _shape_group_id, _shapes):
        self._shape_group_name = _shape_group_name
        self._shape_group_id = _shape_group_id
        self._shapes = _shapes

    def __init__(self, _shape_group_name, _shape_group_id):
        self._shape_group_name = _shape_group_name
        self._shape_group_id = _shape_group_id

    @property
    def shape_group_name(self):
        return self._shape_group_name

    @shape_group_name.setter
    def shape_group_name(self, _shape_group_name):
        self._shape_group_name = _shape_group_name


    @property
    def shape_group_id(self):
        return self._shape_group_id

    @shape_group_id.setter
    def shape_group_id(self, _shape_group_id):
        self._shape_group_id = _shape_group_id

    @property
    def shapes(self):
        return self._shapes

    @shapes.setter
    def shapes(self, _shapes):
        self._shapes = _shapes


class shape(object):
    def __init__(self, _shape_id, _color, _title, _desc, _detail):
        self._shape_id = _shape_id
        self._color = _color
        self._title = _title
        self._desc = _desc
        self._detail = _detail
        self._ext1=''


    @property
    def shape_id(self):
        return self._shape_id

    @shape_id.setter
    def shape_id(self, _shape_id):
        self._shape_id = _shape_id


    # primary,success,info,warning,danger (bootstrap)
    # green,red,yellow (sb-admin)
    @property
    def color(self):
        return self._color

    @color.setter
    def color(self, _color):
        self._color = _color
    @property
    def ext1(self):
        return self._ext1

    @ext1.setter
    def ext1(self, _ext1):
        self._ext1 = _ext1
    @property
    def title(self):
        return self._title

    @title.setter
    def title(self, _title):
        self._title = _title

    @property
    def desc(self):
        return self._desc

    @desc.setter
    def desc(self, _desc):
        self._desc = _desc

    @property
    def detail(self):
        return self._detail

    @detail.setter
    def detail(self, _detail):
        self._detail = _detail


class shape_charts(object):
    """
        chart: {
            type: 'spline'
        },
        title: {
            text: 'Snow depth at Vikjafjellet, Norway'
        },
        subtitle: {
            text: 'Irregular time data in Highcharts JS'
        },
      yAxis: {
              title: {
                  text: '消息数量'
              },
              plotLines: [
                  {
                      value: 0,
                      width: 1,
                      color: '#808080'
                  }
              ]
          },

           xAxis: {
              categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
          },
          tooltip: {
            formatter: function() {
                    return '<b>'+ this.series.name +'</b><br/>'+
                    Highcharts.dateFormat('%e. %b', this.x) +': '+ this.y +' m';
            }
        },

          legend: {
              layout: 'vertical',
              align: 'right',
              verticalAlign: 'middle',
              borderWidth: 0
          },

           series: [
              {
                  name: 'Tokyo',
                  data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
              },
              {
                  name: 'New York',
                  data: [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5]
              },
              {
                  name: 'Berlin',
                  data: [-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0]
              },
              {
                  name: 'London',
                  data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]
              }
          ]
      """

    def set_tooltip(self, dict):
        self.tooltip = dict

    def set_chart(self, chartDict):
        self.chart = chartDict

    def set_chart_type(self, chartType):
        self.chart['type'] = chartType

    def set_xAxis(self, array):
        self.xAxis = {
            'categories': array
        }

    def set_xAxis_all(self, dict):
        self.xAxis = dict

    def set_series_all(self, array):
        self.series = array

    def add_series_one(self, one):
        self.series.append(one)

    def set_title(self, _titlename):
        self.title = {
            'text': _titlename
        }

    def __init__(self):
        self.chart = {

        }

        self.title = {
            'text': ""
        }
        self.yAxis = {
            'title': {
                'text': '消息数量'
            },
            'plotLines': [
                {
                    'value': 0,
                    'width': 1,
                    'color': '#808080'
                }
            ]
        }
        self.xAxis = {
          #  'categories': ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
        }

        self.tooltip = {
           # 'valueSuffix': ' '
        }
        self.legend = {
            'layout': 'vertical',
            'align': 'right',
            'verticalAlign': 'middle',
            'borderWidth': 0
        }
        self.series = [
            # {
            #     'name': 'Tokyo',
            #     'data': [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
            # },
            # {
            #     'name': 'New York',
            #     'data': [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5]
            # },
            # {
            #     'name': 'Berlin',
            #     'data': [-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0]
            # },
            # {
            #     'name': 'London',
            #     'data': [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]
            # }
        ]




